//
// Created by 33145 on 2023/5/29.
//

#include "timer_event.h"
#include "../common/log.h"
#include "../common/util.h"

namespace rocket {

  TimerEvent::TimerEvent(int interval, const std::function<void()>& cb,
                         bool is_repeated /*=false*/)
                         : _interval(interval), _is_repeated(is_repeated), _task(cb) {
    resetArriveTime();
  }

  void TimerEvent::resetArriveTime() {
    _arrive_time = getNowMs() + _interval;
    LOG_DEBUG("reset time event, next time is [%lld]", _arrive_time);
  }

}